package com.open.capacity.forum.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Comment implements Serializable {
    /**
     * 评论id,主键,自增
     */
    @TableId(value = "comtid", type = IdType.AUTO)
    @JsonSerialize(using= ToStringSerializer.class)
    private Long comtid;

    /**
     * 评论类型（1 文章 2 用户资源）
     */
    private Integer cotype;

    /**
     * 评论人id
     */
    @JsonSerialize(using= ToStringSerializer.class)
    private Long userid;

    /**
     * 评论对象id（文章下的评论或资源文件下的评论id）
     */
    private Integer cobjid;

    /**
     * 父级评论id
     */
    private Long pcomid;

    /**
     * 被回复的评论id
     */
    private Long recoid;

    /**
     * 被回复的评论用户id
     */
    private Long recuid;

    /**
     * 评论内容
     */
    private String content;

    /**
     * 点赞数 默认为0
     */
    private Integer prenum;

    /**
     * 是否置顶 1 置顶
     */
    private Boolean istops;

    /**
     * 数据状态1:正常 2:逻辑删除 默认为1
     */
    @TableLogic(value = "1", delval = "2")
    private Boolean status;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date cretim;

    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updtim;

    private static final long serialVersionUID = 1L;
}

